#include <malloc.h>

#include <sys/shm.h>
#include <errno.h>
#include <string.h>

struct AA{
	int a;
	int b;
};

int main()
{
	key_t conf_key;
	int conf_id;


	/*creat share memory of configure*/
	conf_key = 950090200;
	conf_id = shmget(conf_key, sizeof(struct AA), 0);
	if(-1 == conf_id)
	{
		printf("<APP/CHECK>Get share memory fail!(%s)\n", strerror(errno));
		//return -1;
	}

	struct AA* aa = (struct AA *)shmat(conf_id, NULL, 0);
	if((struct AA *)(-1) == aa)
	{
		printf("<APP/CHECK>cat not get memory address!(%s)\n", strerror(errno));
		return -1;	
	}
	while(1) {
		sleep(1);
		printf("%d %d\r\n", aa->a, aa->b);
	}	

	return 0;
}

